import axiosServer from "@/utils/request";

/**
 * 活动-规则修改
 * @param id
 * @param type
 * @param activityName 活动名称
 * @param reward 奖励
 * @param rule 规则
 * @param startTime 开始时间
 * @param endTime 结束时间
 * @param route 路径
 * @param upper 是否上线活动
 * @param hot  是否上热门
 * @param residueQuota 总额度
 * @param quota 已发放额度
 * @param probability 概率
 * @paran currencyId 货币id
 * @paran amount 单个抽奖所需货币
 * @paran rare 稀有阈值
 * @returns {*}
 */
export const activityUpdate = (id, myKey, type, activityName, reward, rule, startTime, endTime, route, upper, hot, extraRule) => {
    return axiosServer({
        method: "post",
        url: "/activityControl/update",
        data: { id, myKey, type, activityName, reward, rule, startTime, endTime, route, upper, hot, extraRule }
    });
};
/**
 * 修改是否上线
 * @param id
 * @param upper // true、false
 * @returns {*}
 */
export const activityUpdateUpper = (id, upper) => {
    return axiosServer({
        method: "post",
        url: "/activityControl/updateUpper",
        params: { id, upper }
    });
}
/**
 * 修改是否热门
 * @param id
 * @param hot // true、false
 * @returns {*}
 */
export const activityUpdateHot = (id, hot) => {
    return axiosServer({
        method: "post",
        url: "/activityControl/updateHot",
        params: { id, hot }
    });
}

/**
 * 活动-规则查询
 * @param route
 * @returns {*}
 */
export const activityLoadByRoute = (route) => {
    return axiosServer({
        method: "get",
        url: "/activityControl/updateHot/" + route,
    });
}
/**
 * 活动-规则查询  id
 * @param id
 * @returns {*}
 */
export const activityLoadById = (id) => {
    return axiosServer({
        method: "get",
        url: "/activityControl/loadById/" + id,
    });
}
/**
 * 活动分页查询（后台）
 * @param type type
 * @param upper 是否上线活动
 * @param hot 是否上热门
 * @param page
 * @param limit
 * @returns {*}
 */
export const activityListData = (type, upper, hot, page, limit) => {
    return axiosServer({
        method: "get",
        url: "/activityControl/listData",
        params: {
            type, upper, hot, page, limit
        }
    });
}